/*****************************************************************************
Copyright 2006 Kervin L. Pierre
    EMAIL: otlkcon@adevsoft.com

This file is part of Otlkcon.

Otlkcon is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

Otlkcon is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Lesser GNU General Public License for more details.

You should have received a copy of the Lesser GNU General Public License
along with Otlkcon; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

*******************************************************************************/

#pragma once
#include <windows.h>
#include <mapi.h>
#include <mapispi.h>
#include <mapival.h>
#include <imessage.h>

#include "boost/pool/singleton_pool.hpp"

struct otlkcon_tag { };

class otlkcon_memory
{
public:
    otlkcon_memory(LPALLOCATEBUFFER lb, LPALLOCATEMORE lm , LPFREEBUFFER lf);
    otlkcon_memory( otlkcon_memory *memObj );
    ~otlkcon_memory();

    void *malloc( ULONG size );
    void *mallocMore( void *obj, ULONG size );
    void free( void *buff );
    char *_strdup( const char *str );
    char *_strdupMore( void *parentObj, const char *str );

	LPSPropValue propdup(ULONG cValues, LPSPropValue lpSrc);
	LPBYTE bindup(ULONG cb, LPBYTE lpb);
	wchar_t *w_strdup( const wchar_t *str );
	wchar_t *w_strdupMore( void *parentObj, const wchar_t *str );

    // Pool
    void *pMalloc( ULONG size );
    void pFree( void *buff );
    char *pStrdup( const char *str );
    wchar_t *pWcsdup( const wchar_t *str );

    LPALLOCATEBUFFER lpAllocateBuffer;
    LPALLOCATEMORE lpAllocateMore;
    LPFREEBUFFER lpFreeBuffer;
};